public class HomeWork13_11{
    public static void main(String[] args){
        String str = "01#张三#20-02#李四#30-03#王五#40";
        AllStudents as = new AllStudents(str);
        as.show();
        System.out.println("总分为: " + as.totalScore());
    }
}

class Student{
    private String id;
    private String name;
    private short score;
    
    public Student(String str){
        String[] strArr = str.split("#");
        id = strArr[0];
        name = strArr[1];
        score = Short.parseShort(strArr[2]);
    }
    public void show(){
        System.out.println(id + " " + name + " " + score);
    }
    public short getScore(){
        return score;
    }
}

class AllStudents{
    public Student[] stu;
    
    public AllStudents(String str){
        String[] stuStrArr = str.split("-");
        stu = new Student[stuStrArr.length];
        for(int i = 0; i < stuStrArr.length; i++){
            stu[i] = new Student(stuStrArr[i]);
        }
    }
    public void show(){
        for(Student item : stu){
            item.show();
        }   
    }
    public int totalScore(){
        int ans = 0;
        for(Student item : stu){
            ans += item.getScore();
        }
        return ans;
    }
}